package com.huangyi.mstemplateservice.controller;



import com.huangyi.commondomain.domain.R;
import com.huangyi.mstemplateservice.rabbit.Producer;
import com.huangyi.mstemplateservice.userinfo.MessageDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/test/rabbit")
public class TestRabbitController {

    @Autowired
    private Producer producer;

    @PostMapping("/send")
    public R<Void> send() {
        MessageDTO messageDTO = new MessageDTO();
        messageDTO.setMessage("hello");
        producer.produceMsg(messageDTO);
        return R.ok();
    }


}
